<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" " http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>主页 | 短信平台</title>
<jsp:include page="/WEB-INF/jsp/common/commonlist.jsp"></jsp:include>
<script type="text/javascript">
function bodyLoad(){
	activeMenuItem("messageManageItem","templateCatItem");
}
//查询类别 
function queryCategory(){
	document.getElementById('ywlx').value = 'CX';
	document.forms.form1.action = "queryCategory.do";
	document.forms.form1.submit();
}
//显示全部分类 
function showAllCategory(){
	document.getElementById('ywlx').value = 'QB';
	document.forms.form1.action = "showAllCategory.do";
	document.forms.form1.submit();
}
//添加分类 
function doaddCategory(){
	document.getElementById('ywlx').value = 'TJFL';
	document.forms.form1.action = "doaddCategory.do";
	document.forms.form1.submit();
}
//首页
function sy(page){

	document.getElementById("current").value=page;
	<c:if test="${tempTitle == null}">
	document.forms.form1.action = "showAllCategory.do";
	</c:if>
	<c:if test="${tempTitle != null}">
	document.forms.form1.action = "queryCategory.do";
	</c:if>
	document.forms.form1.submit();
}
//上一页
function syy(page){
	document.getElementById("current").value=page;
	<c:if test="${tempTitle == null}">
	document.forms.form1.action = "showAllCategory.do";
	</c:if>
	<c:if test="${tempTitle != null}">
	document.forms.form1.action = "queryCategory.do";
	</c:if>
	document.forms.form1.submit();
}
//下一页
function xyy(page){
	document.getElementById("current").value=page;
	<c:if test="${tempTitle == null}">
	document.forms.form1.action = "showAllCategory.do";
	</c:if>
	<c:if test="${tempTitle != null}">
	document.forms.form1.action = "queryCategory.do";
	</c:if>
	document.forms.form1.submit();
}
//尾页 
function wy(page){
	document.getElementById("current").value=page;
	<c:if test="${tempTitle == null}">
	document.forms.form1.action = "showAllCategory.do";
	</c:if>
	<c:if test="${tempTitle != null}">
	document.forms.form1.action = "queryCategory.do";
	</c:if>
	document.forms.form1.submit();
}
//修改分类信息
function updateTemplateCat(value){
	document.getElementById('ywlx').value = 'CX';
	<c:if test="${tempTitle == null}">
	document.forms.form1.action = "showAllCategory.do";
	</c:if>
	<c:if test="${tempTitle != null}">
	document.forms.form1.action = "queryCategory.do";
	</c:if>
	document.forms.form1.submit();
}
</script>
</head>
<body onload="bodyLoad()">
	<div id="body-wrapper">
		<!-- Wrapper for the radial gradient background -->
		<div id="sidebar">
			<div id="sidebar-wrapper">
				<!-- Sidebar with logo and menu -->
				<h1 id="sidebar-title">
					<a href="#">短信平台</a>
				</h1>
				<!-- Sidebar Profile links -->
				<!--  页面左上角的部分 -->
				<%@include file="/WEB-INF/jsp/common/leftTop.jsp"%>
				<!-- 页面左侧菜单部分 -->
				<%@include file="/WEB-INF/jsp/common/menu.jsp"%>


				<!-- End #messages -->
			</div>
		</div>
		<!-- End #sidebar -->
		<div id="main-content">
			<!-- Main Content Section with everything -->
			<noscript>
				<!-- Show a notification if the user has disabled javascript -->
				<div class="notification error png_bg">
					<div>
						Javascript is disabled or is not supported by your browser. Please
						<a href="http://browsehappy.com/"
							title="Upgrade to a better browser">upgrade</a> your browser or <a
							href="http://www.google.com/support/bin/answer.py?answer=23852"
							title="Enable Javascript in your browser">enable</a> Javascript
						to navigate the interface properly. Download From <a
							href="http://www.exet.tk">exet.tk</a>
					</div>
				</div>
			</noscript>
			<%@ include file="/WEB-INF/jsp/common/top.jsp" %>
	    <!-- End .shortcut-buttons-set -->
	    <div class="clear"></div>
		    <!-- End .clear -->
		    <div class="content-box">
		      <!-- Start Content Box -->
		      <div class="content-box-header">
					<h3>短信模板类别</h3>
					<ul class="content-box-tabs">
					</ul>
					<div class="clear"></div>
				</div>
				<!-- End .content-box-header -->
				<div class="content-box-content">
					<div class="tab-content default-tab" id="tab1">
						<form action="#" method="post" id="form1">
							<input type="hidden" name="ywlx" id="ywlx" /> <input
								type="hidden" name="bz" id="bz" /> <input type="hidden"
								name="current" id="current" />
							<table>
								<tr style="background-color: rgb(229, 229, 229);">
									<td><label style="padding-bottom: 0px;">名称：</label></td>
									<td><input type="text" id="" name="Category"
										value="<c:out value="${tempTitle}"/>" /></td>
									<td><input type="button" value="查询"
										onclick="queryCategory();" /></td>
									<td><input type="button" value="显示全部"
										onclick="showAllCategory();" /></td>
									<td><label style="padding-bottom: 0px;">添加分类：</label></td>
									<td><input type="text" id="" name="addCategory" /></td>
									<td><input type="button" value="添加"
										onclick="doaddCategory();" />
								</tr>
							</table>
							<table>
								<thead>
									<tr>
										<th><input class="check-all" type="checkbox" /></th>
										<th>ID</th>
										<th>分类名称</th>
										<th>短信条数</th>
										<th>编辑分类</th>
										<th>创建时间</th>
										<th>操作</th>
									</tr>
								</thead>
								<tfoot>
									<tr>
										<td colspan="6">
											<div class="bulk-actions align-left">
												<a class="button" href="#" onclick="showAllCategory();">显示全部</a>
												<a class="button" href="showAllTemplate.do">显示模板列表</a>
											</div>
											<div class="pagination" style="font-size: 12px;">
												<a href="#" onclick="sy('0')" title="First Page">&laquo;
													首页</a><a href="#" onclick="syy('<c:out value="${proPage}"/>')"
													title="Previous Page">&laquo; 上一页</a>
												${result.currPage}/${result.pageCount } <a href="#"
													onclick="xyy('<c:out value="${nextPage}"/>')"
													title="Next Page">下一页 &raquo;</a><a href="#"
													onclick="wy('<c:out value="${pageCount}"></c:out>');"
													title="Last Page">尾页 &raquo;</a>
											</div> <!-- End .pagination -->
											<div class="clear"></div>
										</td>
									</tr>
								</tfoot>
								<tbody>
									<c:forEach var="result" items="${resultList}" varStatus="sn">
										<tr>
											<td><input type="checkbox" /></td>
											<td><c:out value="${result.tempId}"></c:out></td>
											<td><c:out value="${result.tempTitle}"></c:out></td>
											<td><c:out value="${result.contentCount}"></c:out></td>
											<td><input type="text" name="${result.tempId}" /><input
												type="button" value="修改"
												onclick="updateTemplateCat('<c:out value="${result.tempId}"></c:out>');" /></td>
											<td><fmt:formatDate value="${result.createtime}"
													pattern="yyyy年MM月dd日 " /></td>
											<td>
												<!-- Icons --> <a
												href="editTemplateCat.do?tempId=<c:out value="${result.tempId}"/>&page=<c:out value="${ currentPage}"/>"
												title="编辑模板"><img src="images/icons/pencil.png"
													alt="Edit" /></a> <a
												href="deleteNewTemplateCat.do?tempId=<c:out value="${result.tempId}"/>&page=<c:out value="${ currentPage}"/>"
												title="Delete"><img src="images/icons/cross.png"
													alt="删除" /></a>
											</td>
										</tr>

									</c:forEach>
								</tbody>
							</table>
						</form>
					</div>
					<!-- End #tab1 -->
				</div>
				<!-- End .content-box-content -->
			</div>
			<!-- End .content-box -->
			<div class="clear"></div>
			<%@ include file="/WEB-INF/jsp/common/copyright.jsp"%>
		</div>
		<!-- End #main-content -->
	</div>
	<script>
<c:if test="${!(message eq '') && message != null}">
 alert('${message}');
</c:if>
<c:if test="${!(error eq '') && error != null}">
alert('${error}');
</c:if>
</script>
</body>
</html>